//
//  EventsCellView.m
//  LStyle
//
//  Created by Obaid Abdul Maroof on 12/20/09.
//  Copyright 2009 Vrije University. All rights reserved.
//

#import "EventsCellView.h"


@implementation EventsCellView

- (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier{
	if (self = [super initWithFrame:aRect reuseIdentifier:identifier])
	{
		// turn off selection use
		self.selectionStyle = UITableViewCellSelectionStyleGray;
		
		CGSize size = aRect.size;
		
		

		lblDate = [[UILabel alloc] initWithFrame:CGRectMake(5, 25, (aRect.size.width/4) - 5, 20)];
		
		lblName = [[UILabel alloc] initWithFrame:CGRectMake(10 + (aRect.size.width/4), 5, (3*aRect.size.width/4) - 20 , 20)];
		
		lblDescription = [[UILabel alloc] initWithFrame:CGRectMake(10 + (aRect.size.width/4), 5, (3*aRect.size.width/4) - 10 , 50)];
		lblDescription.lineBreakMode = UILineBreakModeWordWrap;
		lblDescription.numberOfLines = 0;
		
		lblDate.text = @"1 NOV";
		lblName.text = @"LONDON FASHION";
		lblDescription.text = @"Lorem ipsum dolor sit amet, con slor sit amet, This is a test descreption.";
		
		lblDate.font = [UIFont fontWithName:@"Verdana" size: 10.0];
		lblName.font = [UIFont fontWithName:@"Verdana" size: 10.0];
		lblDescription.font = [UIFont fontWithName:@"Verdana" size: 9.0];
		
		[self.contentView addSubview:lblDate];
		[self.contentView addSubview:lblName];
		[self.contentView addSubview:lblDescription];
	}
    
	return self;
}


- (void)layoutSubviews
{
	[super layoutSubviews];
	CGRect rect = [self.contentView bounds];
	CGRect rect2 = [self.contentView bounds];
	CGSize size = rect.size;
	CGSize size2 = size;
	
	rect.origin.x = 5;
	rect.origin.y = 22;
	size.width = (size.width/4) - 10;
	size.height = 20;
	rect.size = size;
	
	lblDate.frame = rect;	
	
	
	rect.origin.y = 5;
	rect.origin.x = 10 + lblDate.frame.size.width;
	size.width = rect2.size.width - size.width - 20;
	size.height = 20;
	rect.size = size;	
	
	lblName.frame = rect;
	
	rect.origin.y = 20;
	rect.size.height = 50;
	lblDescription.frame = rect;
	
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)dealloc {
    [super dealloc];
}


@end
